package com.share.beta.feign.outapi;

import com.share.beta.feign.outapi.config.OutFeignConfig;
import com.share.beta.feign.outapi.dto.dto.UserRsAReq;
import com.share.beta.feign.outapi.dto.dto.UserRsAResp;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @EnableFeignClients 需要写在启动类上, 写在别的地方没有用
 * PostMapping 中的参数不能重复
 * <p>
 * post请求RequestBody 用于标记body体
 * get请求RequestParam  用户标记url上的参数
 * <p>
 * http.feign.name.mock1=mock-client1
 * http.feign.rootUrl.mock=http://192.168.102.1
 * <p>
 * 值以http开头有标记意义
 */
@FeignClient(value = "${http.feign.name.mock1}", url = "${http.feign.rootUrl.mock}", configuration = OutFeignConfig.class)
public interface OutApiFeign {
    @PostMapping("/mock/hp/code")
    UserRsAResp hpPost(UserRsAReq req);

    @GetMapping("/mock/hp/111")
    UserRsAResp hpGet(@RequestParam String req, @RequestParam String ab);

    @GetMapping("/mock/hp/{id}")
    UserRsAResp hpRest(@PathVariable("id") int id);
}
